<template>
  <div >
    <div v-for="item of list" :key="item.id" v-if="item.state === tag">
      <div @click="goGainDetail(item.id)" class="row" >
        <span class="gainName">
            <svg class="icon taskIcon" aria-hidden="true">
              <use xlink:href="#iconwancheng"></use>
            </svg>
            {{item.name}}
          </span>
          <span class="leaderName">
            <svg class="icon fuzerenIcon" aria-hidden="true">
              <use xlink:href="#iconren"></use>
            </svg>
            {{item.ownerName}}
          </span>
      </div>
      <el-divider></el-divider>
    </div>
  </div>
</template>

<script>
import Cookies from 'js-cookie'
import axios from 'axios/index'
export default {
  name: 'checkGains',
  data () {
    return {
      list: [],
      tag: this.GainWaitForCheck
    }
  },
  methods: {
    goGainDetail (gainId) {
      sessionStorage.setItem('gainID', gainId)
      sessionStorage.setItem('activeMenu', '3')
      this.$router.push('/checkGainDetail')
    },
    getGainList () {
      axios.get(this.url + '/gain/leader/' + Cookies.get('id'))
        .then(this.getGainListSucc)
    },
    getGainListSucc (res) {
      if (res.status === 200) {
        res = res.data
        this.list = res
      }
    }
  },
  mounted () {
    this.getGainList()
  }
}
</script>

<style lang="stylus" scoped>
  .gainName
    margin-left .3rem
  .right
    float: right
  .iconMargin
    margin-right .3rem
  .textColor
    color #0D0D0D
  .iconColor
    color #88d4ff
  .taskIcon
    margin-right .35rem
  .row
    margin-top .6rem
    margin-left .5rem
    margin-bottom .6rem
  .leaderName
    float right
    margin-right .9rem
  .fuzerenIcon
    margin-right .3rem
    color #88d4ff
</style>
